package cn.bdqn.controller;

import cn.bdqn.common.Result;
import cn.bdqn.common.error.LoginError;
import cn.bdqn.entity.Staff;
import cn.bdqn.entity.dto.UserDto;
import cn.bdqn.entity.vo.UserVo;
import cn.bdqn.service.StaffService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
public class UserController {
    @Resource
    StaffService staffService;
    @PostMapping("login")
    public Result<UserVo> login(@RequestBody UserDto userDto) throws LoginError {
        return Result.ok(staffService.login(userDto.getUsername(),userDto.getPassword()));
    }
}
